﻿using HomagChina.CCHCS.DataTypeModel;
using HomagChina.CCHCS.ViewModels;
using HomagChina.CCHCS.Views;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using HomagGroup.BaseUI.Router;
using System.Collections.ObjectModel;

using static HomagChina.CCHCS.ProcessResourceInternal;
using static HomagChina.CCHCS.Utility;

namespace HomagChina.CCHCS.Router
{
    public class HomeRoute : NotifyPropertyChangedBase
    {
        public RouterItemDataModel HomeRouteModel { get; set; }

        public HomeRoute()
        {
            var model = new HomeViewModel();
            var userControl = GetUserControlInstance("Home") as Home;
            HomeRouteModel = new RouterItemDataModel()
            {
                ID = "Home",
                viewLabel = GetLocalText("Home"),
                viewName = "Home",
                keepalive = true,
                viewModelName = "HomeViewModel",
                ViewModel = model,
                userControl = userControl,
                Image = GetIconBrush(Icon.Home),
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>
                {
                    new FunctionKeyBarItemDataModel() {
                        Header =  GetLocalText("BatchDetail"),
                        Position = 11,
                        Icon = GetIconBrush(Icon.Menu,overlayIcon: OverlayIcon.Magnify),
                        Command =  new RelayCommand(()=>{model.HandleOpenBatchDetail(); })
                    },
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Error message"),
                    //    Position = 11,
                    //    Icon = GetResourceBrush("ErrorMessages"),
                    //    Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("ErrorMessage"); })
                    //},
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("History"),
                    //    Position = 10,
                    //    Icon = GetResourceBrush("history") ,
                    //    Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("TransHistory"); })
                    //},
                    new FunctionKeyBarItemDataModel() {
                        Header =GetLocalText("Stock"),
                        Position = 10,
                        Icon = GetIconBrush(Icon.ViewDashboard),
                        Command = new RelayCommand(() => { NavigateServices.Instance.NavigateTo("Stock"); })
                    },
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Boardibrary"),
                    //    Position = 9,
                    //    Icon = GetIconBrush(Icon.Database),
                    //    Command = new RelayCommand(() => { NavigateServices.Instance.NavigateTo("BoardLibrary"); })
                    //},
                    new FunctionKeyBarItemDataModel() {
                        Header =  GetLocalText("Joblist"),
                        Position = 8,
                        Icon = GetResourceBrush("JobList"),
                        Command = new RelayCommand(() => { NavigateServices.Instance.NavigateTo("JobList"); })
                    },
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Statistics"),
                    //    Position = 3, Icon = GetResourceBrush("Statistics"),
                    //    Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("Statistics"); })
                    //},
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  LocalText.Statistics,
                    //    Position = 3, Icon = GetResourceBrush("Statistics"),
                    //    Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("Statistics"); })
                    //},
                    new FunctionKeyBarItemDataModel()
                    {
                        Header = GetLocalText("Settings"),
                        Position = 2,
                        Icon = GetResourceBrush("Settings"),
                        Command = new RelayCommand(() => { NavigateServices.Instance.NavigateTo("Settings"); })
                    },
                    new FunctionKeyBarItemDataModel()
                    {
                        Header = GetLocalText("Info"),
                        Position = 1,
                        Icon = GetIconBrush(Icon.Information, imageDecoration: ImageDecoration.Circle),
                        Command = new RelayCommand(() => { new Utility().OpenInformationCommand(); })
                    }
                }
            };
            HomeRouteModel.userControl.DataContext = model;
        }
    }
}